<?php
	
	/**
	 * Load doctype
	 */
	$plugins -> html -> doctype ( "XHTML 1.0 Strict" );
	
?>

<head>

<?php

	/**
	 * Lets load standard meta tags...
	 * ( title, content-type, author, organization, keywords, description )
	 */
	$plugins -> head -> standardMeta();
	
	/**
	 * Deny access for robots!!!! 
	 */
	$plugins -> robots -> deny();

	/**
	 * Load css template!
	 */
	$plugins -> css -> load(
		array (
			"style"     => "screen",
			"styleIE"   => "screen",
			"styleIE7"  => "screen"
		)
	);
	
	?>
	<script type="text/javascript">
		var domain = '<?php self::$system -> enviroment -> url ?>backend/';
	</script>
	<?php
	
	/**
	 * Lets go load javascript files...
	 */
	$plugins -> js -> load( array (
		"jquery-1.2.6" => false,
		//"jquery/hotkeys"    => false,
		"jquery-ui"         => false,
		"workspaceat/menu"  => false,
		//"workspaceat/hotkeys"  => false,
		"workspaceat/fastlaunch" => false,
		//"workspaceat/alerts"     => false,
		//"workspaceat/notice_window" => false,
		"workspaceat/window"     => false,
		"workspaceat/accordian"  => false,
		"workspaceat/pages"      => false,
	));
	
	
?>
	
</head>
<body id="body">
	
	<!-- PROGRESS AREA -->
	<div class="progress" id="progress">
		<p id="pmessage">Please wait...</p>
	</div>
	
	<!-- ADD NEW PAGE AREA-->
	<div class="notice" id="addpage">
		
		<div class="box">
			<div class="header">
				<h2>Add new page!</h2>
				
				<img class="x" id="close" src="<?php echo $plugins -> css -> getCssPath(); ?>/elements/exit_btn_notice.png" alt="Close window" />
			</div>
			
			<div class="container">
				<p>Please enter page name. Page name can't contain special characters and they
				   must not be longer than 50 chars as they can't be smaller than 3 chars! Please
				   see documentation for more 
				   <a href="<?php echo $plugins -> page -> link ( "manual/pages/addpage/limitations" ); ?>" 
				   title="<?php echo $plugins -> language -> startlinktitle; ?>" >details</a></p>
				
					
				<form  id="addpage_form" action="<?php echo $plugins -> page -> link ( "pages/add/validate" ); ?>" onsubmit="return false;">
					<ul>
						<li>
							<label>Choose group or sub-group</label>
							<select name="group" id="groupspg_chooser" style="margin-bottom:20px">
									<option value=":0/:0/">Choose existing group...</option>
									<option value=":standalone/:0/">Standalone ( default group! )</option>
									<?php
										$agroups = $plugins->pagegroup->getActiveGroups();
										
										foreach ( $agroups as $group ):
										
											# lets get parrent group
											if ( $group->type == 'parent' )
											{	
												$parenth = $plugins -> pagegroup ->getGroupById( $group -> parentof );
												$ufkingC = ucfirst( $parenth->name );
												$groupname = ucfirst( $group->name ) . " ( Parent of: {$ufkingC} )";	
											}else
											{
												$groupname =  ucfirst( $group->name );
											}
		
									?>
									<option value=":<?php echo $group->unixname; ?>/:<?php echo $group->id; ?>/">
									<?php echo $groupname; ?></option>
									<?php
											
										endforeach;
									?>
							</select>
						</li>
						<li>
							<label>New page name</label>
							<input type="text" name="addpage" id="addpage_input" />
						</li>
					</ul>
				</form>
				
				<div class="valid" id="message_box">
					<p id="message">System is currently waiting for inputs!</p>
				</div>
				
				<a href="#" class="likebutton" id="noticeap_ok"  title="">Add new page!</a>
				<a href="#" class="likebutton" id="notice_not" title="">Cancel it!</a>
			</div>
			
			<div class="footer">&nbsp;</div>
		</div>
		
	</div>

	<!-- MODIFY GROUP AREA-->
	<div class="notice" id="modifygroup_box">
		
		<div class="box">
			<div class="header">
				<h2>Manage existing group!</h2>
				
				<img class="x" id="close_mg" src="<?php echo $plugins -> css -> getCssPath(); ?>/elements/exit_btn_notice.png" alt="Close window" />
			</div>
			
			<div class="container">
				<p>Welcome to manage existing group area. To manage it, please choose group from list below and
				click on manage. For more details please check manual for more
				   <a href="<?php echo $plugins -> page -> link ( "manual/pages/groups/manage" ); ?>" 
				   title="<?php echo $plugins -> language -> startlinktitle; ?>" >details</a></p>
					
				<form  id="modifygroups_form" action="<?php echo $plugins -> page -> link ( "pages/groups/modify/" ); ?>" onsubmit="return false;">
					<ul>
						<li>
							<label>Choose group or sub-group</label>
							<select name="group" id="groupsmg_chooser">
									<option value="0">Choose existing group...</option>
									
									<?php
										$agroups = $plugins->pagegroup->getActiveGroups();
										
										foreach ( $agroups as $group ):
										
											# lets get parrent group
											if ( $group->type == 'parent' )
											{	
												$parenth = $plugins -> pagegroup ->getGroupById( $group -> parentof );
												$ufkingC = ucfirst( $parenth->name );
												$groupname = ucfirst( $group->name ) . " ( Parent of: {$ufkingC} )";	
											}else
											{
												$groupname =  ucfirst( $group->name );
											}
		
									?>
									<option value=":<?php echo $group->unixname; ?>/:<?php echo $group->id; ?>/">
									<?php echo $groupname; ?></option>
									<?php
											
										endforeach;
									?>
							</select>
						</li>
					</ul>
				</form>
				
				<div class="valid" id="messagemg_box">
					<p id="message_mg">System is currently waiting for you!</p>
				</div>
				
				<a href="#" class="likebutton" id="noticemg_ok"  title="">Manage group!</a>
				<a href="#" class="likebutton" id="noticemg_not" title="">Cancel it!</a>
			</div>
			<div class="footer">&nbsp;</div>
		</div>
	</div>

	<!-- DELETE GROUP AREA-->
	<div class="notice" id="deletegroup_box">
		
		<div class="box">
			<div class="header">
				<h2>Delete existing group from system!</h2>
				
				<img class="x" id="close_gg" src="<?php echo $plugins -> css -> getCssPath(); ?>/elements/exit_btn_notice.png" alt="Close window" />
			</div>
			
			<div class="container">
				<p>Welcome to garbage existing group area. Please make sure that you understand text colored in red.
				   Before anything please read manual for more
				   <a href="<?php echo $plugins -> page -> link ( "manual/pages/addpage/limitations" ); ?>" 
				   title="<?php echo $plugins -> language -> startlinktitle; ?>" >details</a></p>
				
				<p class="alert">Consider that garbaging group will garbage any existing page under it! Before garbaging please
				remove all pages from this group to another or if you like, garbage them all :) This action can be restored by
				navigating to page garbage area!</p> 
					
				<form  id="garbagegroup_form" action="<?php echo $plugins -> page -> link ( "pages/groups/delete/" ); ?>" onsubmit="return false;">
					<ul>
						<li>
							<label>Choose group or sub-group</label>
							<select name="group" id="groupsgg_chooser">
									<option value="0">Choose existing group...</option>
									
									<?php
										$agroups = $plugins->pagegroup->getActiveGroups();
										
										foreach ( $agroups as $group ):
										
											# lets get parrent group
											if ( $group->type == 'parent' )
											{	
												$parenth = $plugins -> pagegroup ->getGroupById( $group -> parentof );
												$ufkingC = ucfirst( $parenth->name );
												$groupname = ucfirst( $group->name ) . " ( Parent of: {$ufkingC} )";	
											}else
											{
												$groupname =  ucfirst( $group->name );
											}
		
									?>
									<option value=":<?php echo $group->unixname; ?>/:<?php echo $group->id; ?>/">
									<?php echo $groupname; ?></option>
									<?php
											
										endforeach;
									?>
							</select>
						</li>
					</ul>
				</form>
				
				<div class="valid" id="messagegg_box">
					<p id="message_gg">System is currently waiting for inputs!</p>
				</div>
				
				<a href="#" class="likebutton" id="noticegg_ok"  title="">Delete group!</a>
				<a href="#" class="likebutton" id="noticegg_not" title="">Cancel it!</a>
			</div>
			
			<div class="footer">&nbsp;</div>
		</div>
		
	</div>
	
	<!-- FAST LAUNCHER AREA -->
	<div class="fastlaunch" id="fastlaunch">
		
		<div class="topfix">
			<img class="x" id="launch_close" src="<?php echo $plugins -> css -> getCssPath(); ?>/elements/launch_x.png" alt="Close window" />
		</div>
		
		<div class="container">
			<h1>Workspace@ quick access</h1>
			
			<p>This area is used for quick access inside of Workspace@ features. Just start to write
			   down and system will find and save your searchs :)</p>
			   
			<input type="text" id="fastlaunch_browser" name="fastlaunch_browser" value="Start to typing..." />
		</div>
		
		<div class="bottomfix">&nbsp;</div>
	</div>
	
	<div class="fastlaunch_activator">
		
		<ul>
			<li>
			<img class="x" id="launch_btn" src="<?php echo $plugins -> css -> getCssPath(); ?>/elements/quicklaunch_btn.png" alt="Close window" />
			</li>
		</ul>
	</div>
	
	<!-- FLOATING QUICK NAVI AREA -->
	<div class="quicknavi" id="quicknavi">
		
		<div class="handler" id="quicknavi_handler">
			<div class="fukyou">
				<img class="quick_handler" id="launch_btn" src="<?php echo $plugins -> css -> getCssPath(); ?>/elements/quickmenu_title_bg.png" 
				alt="Open/Close quick navigation" />
			</div>
		</div>
		
		<div class="container" id="quicknavi_container">
			<h2>Workspace@ Engine standard shortcuts</h2>
			
			<ul>
			
				<li id="homepage_link">
					<h2>Home page</h2>
					<p><a href="<?php echo $plugins -> page -> link ( "" ); ?>" 
					    title="<?php echo $plugins -> language -> startlinktitle; ?>" >Go to Workspace@ Engine home page!</a></p>
				</li>
				
				<li id="quickl_handler">
					<h2>Quick launcher</h2>
					<p>Quick launcher will help you to easily access W@E features!</p>
				</li>
				
				<li>
					<h2>Notes</h2>
					<p id="notes_handler">Do we need to write any description for this?</p>
				</li>
			</ul>
			
			<div class="fukyou2">
				<p>There are no deadlines or alerts to show! That's good :D</p>
				
				<p>If you like to, you can define one :) LoL</p>
			</div>
		</div>
		
	</div>

	<?php
		$repository->menu->loadComponent( "main", "backend" );
	?>
	
	<!-- USER AREA -->
	<div class="userarea">
		
		<!-- Container exists because of bg fix. Don't remove it! -->
		<div class="container">
		
			<h1>quick user area</h1>
			
			<p>Welcome to quick user area. Click on links below to modify your user account</p>
			
			<ul>
				<li>
					<a href="<?php echo $plugins -> page -> link ( "" ); ?>" 
					title="<?php echo $plugins -> language -> startlinktitle; ?>" >Account info</a>
				</li>
				<li>
					<a href="<?php echo $plugins -> page -> link ( "" ); ?>" 
					title="<?php echo $plugins -> language -> startlinktitle; ?>" >Manage profile</a>
				</li>
				<li>
					<a href="<?php echo $plugins -> page -> link ( "" ); ?>" 
					title="<?php echo $plugins -> language -> startlinktitle; ?>" >Team area</a>
				</li>
				<li>
					<a href="<?php echo $plugins -> page -> link ( "" ); ?>" 
					title="<?php echo $plugins -> language -> startlinktitle; ?>" >Private messages (0)</a>
				</li>
				<li>
					<a href="<?php echo $plugins -> page -> link ( "authenticate/logout" ); ?>" 
					title="<?php echo $plugins -> language -> logout; ?>" ><?php echo $plugins -> language -> logout; ?></a>
				</li>
			</ul>
		</div>
		
	</div>
	
	<!-- Top fixer and alert container a.k.a area -->
	<div class="topfix">
		<div class="alert" id="basealert">
			<h1 id="balerttitle">Workspace@ activation error</h1>
			<p  id="balertmessage">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam vel elit. 
			   Sed lobortis blandit lorem. Mauris dictum dolor nec eros. Integer vitae massa id odio rutrum pretium. 
			   Donec ligula leo, tristique et, tempor molestie, accumsan eget, odio. Nullam odio arcu, rutrum vitae, 
			   lobortis in, pharetra quis, nunc.</p>	
		</div>
	</div>
	
	<!-- PAGE WARPER -->
	<div class="warp">
		
		<!-- CONTAINER AREA-->
		<div class="container">
		
			<div class="box">
				<h1>Workspace@ - Page start area</h1>
				<hr />
				<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 
				Nullam vel elit. Sed lobortis blandit lorem. Mauris dictum dolor nec eros. 
				Integer vitae massa id odio rutrum pretium. Donec ligula leo, tristique et, 
				tempor molestie, accumsan eget, odio. Nullam odio arcu,
				rutrum vitae, lobortis in, pharetra quis, nunc.
				Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam vel elit. 
				Sed lobortis blandit lorem. Mauris dictum dolor nec eros. 
				Integer vitae massa id odio rutrum pretium. Donec ligula leo, tristique et, tempor molestie, accumsan eget, odio. Nullam odio arcu,
				rutrum vitae, lobortis in, pharetra quis, nunc.</p>
				
				<ul class="accordian_global_handlers" id="acc_glob_handlers">
					<li>
						<a href="#" title="Expand all" id="acc_expand_all">Expand all</a>
					</li>
					<li>
						<a href="#" title="Collapse all" id="acc_collapse_all">Collapse all</a>
					</li>
				</ul>
				<?php
				
					// STANDALONE PAGES - NOT INSIDE OF ANY GROUPS.. THEY CAN AS WELL BE 
					// 0 POINT OF SOME GROUP
					
					$groups = $plugins -> page -> allocateGroups("standalone");
					$counter = 1;
					
					// lets get frontend url
					$frontendurl = $plugins -> page -> frontendUrl();
					
					if ( $groups[0] ):
				?>
				<div class="accordianlist" id="acchandler_<?php echo "1"; ?>">
					<p class="title"><?php echo $plugins -> language -> standalonetitle; ?></p>

					<ul>
					<?php 
						foreach ( $groups as $group ):
						
							// lets setup url's
							$url = $frontendurl . $group -> unixname;
					?>
						<li id="main_<?php echo $counter; ?>">
							<span><?php echo $counter; ?>.</span>
							<span class="title"><?php echo ucfirst( $group->name ); ?></span>
							<p><?php echo ucfirst( $group->description ); ?></p>
							<div>
								<a href="#" class="preview_btn" title="<?php echo $frontendurl . $group -> unixname; ?>">Preview</a>
								<a href="<?php echo $plugins -> page -> link ( "pages/manage/:" . $group -> unixname . "/:" .$group -> id ); ?>" class="manage_btn" title="#">Manage</a>
								<a href="#" title="<?php echo "standalone:true::page:". $group -> unixname ."::id:" . $group -> id; ?>" class="delete_btn">Delete</a>
							</div>
						</li>
				<?php 
						++$counter;
						endforeach;
						
				?>
					</ul>

				</div>
				<?php
					endif;
				?>
			</div>
			
					
		</div>
		
		<!-- SUBNAVI AREA -->
		<div class="subnavi">
		
			<div class="red" id="description_box">
				
				<div class="topfix">
					&nbsp;
				</div>
				
				<h1>{pagename} quick description</h1>
				<a href="#" title="#">Click here to manage descriptions!</a>
				
				<div class="bottomfix">
					&nbsp;
				</div>
			</div>
			
			
			<div class="blue">
				
				<div class="topfix">
					&nbsp;
				</div>
				
				<h1>Shortcuts</h1>
				<a href="#" title="#">Click here to manage your shortcuts!</a>
				
				<ul>
					<li>
						<a href="#" title="#">Switch working theme</a>
						<p>So that you can start to modify it! :)</p>
					</li>
					
					<li>
						<a href="#" title="#">Switch working language</a>
						<p>And than everyone will be happy! :)</p>
					</li>
					
					<li>
						<a href="#" title="#">Access pages garbage!</a>
						<p>Permanently delete or restore items.</p>
					</li>
				</ul>
				
				<div class="bottomfix">
					&nbsp;
				</div>
			</div>
			
			<div class="red">
				
				<div class="topfix">
					&nbsp;
				</div>
				
				<h1>Groups releated menu</h1>
				<a href="#" title="#">Click here to manage page groups!</a>
				
				<ul>
					<li>
						<a href="<?php echo $plugins -> page -> link ( "pages/groups/list" ); ?>" title="#">List existing groups</a>
						<p>List existing groups, see them modify them!</p>
					</li>
					<li>
						<a href="<?php echo $plugins -> page -> link ( "pages/groups/add" ); ?>" title="#">Add new group</a>
						<p>Add new page group ( category ).</p>
					</li>
					
					<li>
						<a href="#" title="Modify existing groups" id="modifygroups_handler">Modify existing groups</a>
						<p>And than everyone will be happy! :)</p>
					</li>
					
					<li>
						<a href="#" title="#" id="garbagegroup_handler">Garbage existing group</a>
						<p>Send it to garbage!</p>
					</li>
				</ul>
				
				<div class="bottomfix">
					&nbsp;
				</div>
			</div>
			
			<div class="blue">
				
				<div class="topfix">
					&nbsp;
				</div>
				
				<h1>Pages related menu</h1>
				<a href="#" title="#">Click here to manage releated menu!</a>
				
				<ul>
					<li>
						<a href="<?php echo $plugins -> page -> link ( "pages/groups/add" ); ?>" title="#">List existing pages</a>
						<p>List, modify or garbage existing pages!</p>
					</li>
					<li>
						<a href="#" title="#" id="addpage_handler">Add new page</a>
						<p>Add new page inside of active theme!</p>
					</li>
					
					<li>
						<a href="#" title="#" id="modifypage_handler">Manage existing pages</a>
						<p>Select page which you want to modify!</p>
					</li>
					
					<li>
						<a href="#" title="#" id="garbagepage_handler">Garbage existing page</a>
						<p>Send it to garbage!</p>
					</li>
				</ul>
				
				<div class="bottomfix">
					&nbsp;
				</div>
			</div>
			
		</div>
		
	</div>
	
	
	<!-- Bottom fix area -->
	<div class="bottomfix">
	
		<div class="footer">
			<p>Copyright 2008-2009 <a href="http://workspaceat.com" title="#">Workspace@</a> in association with 
			   <a href="http://designstrategist.hr" title="#">Design strategist</a></p>
		</div>
		
	</div>
	
	<!-- PAGE PREVIEW AREA -->
	<div class="pagepreview" id="pagepreview_box">
		
		<div class="topfix">
			<img class="x" id="preview_close" src="<?php echo $plugins -> css -> getCssPath(); ?>/elements/launch_x.png" alt="Close window" />
		</div>
		
		<div class="container">
			<iframe class="sitelook" id="sitelook" src="#"/></iframe>
		</div>
		
		<div class="bottomfix">&nbsp;</div>
	</div>
</body>
</html>